//
//  TCollectionViewCell.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/8.
//  Copyright © 2019 李文强. All rights reserved.
//

#import "TCollectionViewCell.h"

@implementation TCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self initSubView];
    }
    return self;
}
- (void)initSubView{
    self.backgroundColor = MAINBACKCOLOR;
    
    [self addSubview:self.backView];
    [_backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.top.equalTo(@0);
        make.bottom.equalTo(@0);
    }];
    
    [_backView addSubview:self.titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@12);
        make.right.equalTo(@0).offset(-10);
        make.top.equalTo(@10);
        make.height.equalTo(@13);
    }];
    
    [_backView addSubview:self.mentorTeacherLabel];
    [_mentorTeacherLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLabel.mas_left);
        make.right.equalTo(@0).offset(-10);
        make.top.equalTo(@0).offset(38*fh);
        make.height.equalTo(@12);
    }];
    
    [_backView addSubview:self.addressLabel];
    [_addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLabel.mas_left);
        make.right.equalTo(@0).offset(-10);
        make.top.equalTo(@0).offset(60*fh);
        make.height.equalTo(@12);
    }];
    
    [_backView addSubview:self.timeLabel];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLabel.mas_left);
        make.right.equalTo(@0).offset(-10);
        make.top.equalTo(@0).offset(87*fh);
        make.height.equalTo(@12);
    }];
    
    [_backView addSubview:self.chuQingLabel];
    [_chuQingLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@0).offset(-10);
        make.centerY.equalTo(self.mentorTeacherLabel.mas_centerY);
        make.left.equalTo(self.mas_centerX);
        make.height.equalTo(@12);
    }];
}
- (UIView *)backView{
    if (!_backView) {
        UIView *view = [[UIView alloc] init];
        view.frame = CGRectMake(0,0,203.5,105);
        view.backgroundColor = [UIColor colorWithRed:248/255.0 green:248/255.0 blue:248/255.0 alpha:1.0];
        view.layer.cornerRadius = 5;
        _backView = view;
    }
    return _backView;
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(0,0,156.5,13);
        label.numberOfLines = 0;
        label.font = [UIFont systemFontOfSize:14];
        label.textColor = [UIColorChange colorwithHexString:@"#20B097"];
        _titleLabel = label;
    }
    return _titleLabel;
}
- (UILabel *)chuQingLabel{
    if (!_chuQingLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(0,0,156.5,13);
        label.numberOfLines = 0;
        label.textAlignment = 2;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        NSMutableAttributedString *string = [PublickFunctionObject getPriceAttribute:@"出勤 0/12" and:[UIColor redColor] andChangeBenginString:@" " andEndString:@"/" andSize:12];
        label.attributedText = string;
        _chuQingLabel = label;
    }
    return _chuQingLabel;
}
- (UILabel *)mentorTeacherLabel{
    if (!_mentorTeacherLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(0,0,44,11.5);
        label.numberOfLines = 0;
        NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"C培训师" attributes:@{NSFontAttributeName: [UIFont fontWithName:@"PingFang-SC-Regular" size: 12],NSForegroundColorAttributeName: [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0]}];
        label.attributedText = string;
        _mentorTeacherLabel = label;
    }
    return _mentorTeacherLabel;
}
- (UILabel *)addressLabel{
    if (!_addressLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(0,0,84.5,11.5);
        label.numberOfLines = 0;
        NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"交通校区 305室" attributes:@{NSFontAttributeName: [UIFont fontWithName:@"PingFang-SC-Regular" size: 12],NSForegroundColorAttributeName: [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0]}];
        label.attributedText = string;
        _addressLabel = label;
    }
    return _addressLabel;
}
- (UILabel *)timeLabel{
    if (!_timeLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(0,0,84.5,11.5);
        label.numberOfLines = 0;
        NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"2019-03-06 10:00~11：00" attributes:@{NSFontAttributeName: [UIFont fontWithName:@"PingFang-SC-Regular" size: 12],NSForegroundColorAttributeName: [UIColorChange colorwithHexString:@"#FF4800"]}];
        label.attributedText = string;
        _timeLabel = label;
    }
    return _timeLabel;
}
@end
